package com.team.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.Cascade;

@Entity
@Table(name = "computerroom",uniqueConstraints = {@UniqueConstraint(columnNames={"computerroomid"})})
public class ComputerRoom {
	
	private int id;
	private String computerroomid;//机房编号
	private String classname;//机房名称
	private String predeterminedstate;//预定状态
	private String capacity;//可容量
	private String booker;//预约人
	private Set<Equipment> equipment=new HashSet<Equipment>();
	
	public ComputerRoom() {
		super();
	}
	
	public ComputerRoom(String computerroomid, String classname, String predeterminedstate, String capacity,
			String booker) {
		super();
		this.computerroomid = computerroomid;
		this.classname = classname;
		this.predeterminedstate = predeterminedstate;
		this.capacity = capacity;
		this.booker = booker;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	@Column(name="computerroomid")
	public String getComputerroomid() {
		return computerroomid;
	}

	public void setComputerroomid(String computerroomid) {
		this.computerroomid = computerroomid;
	}
	@Column(name="classname")
	public String getClassname() {
		return classname;
	}
	

	public void setClassname(String classname) {
		this.classname = classname;
	}
	@Column(name="predeterminedstate")
	public String getPredeterminedstate() {
		return predeterminedstate;
	}
	public void setPredeterminedstate(String predeterminedstate) {
		this.predeterminedstate = predeterminedstate;
	}
	@Column(name="capacity")
	public String getCapacity() {
		return capacity;
	}

	public void setCapacity(String capacity) {
		this.capacity = capacity;
	}
	@Column(name="booker")
	public String getBooker() {
		return booker;
	}
	
	public void setBooker(String booker) {
		this.booker = booker;
	}
	@OneToMany(targetEntity=Equipment.class,mappedBy="computerRoom")
	public Set<Equipment> getEquipment() {
		return equipment;
	}
	
	public void setEquipment(Set<Equipment> equipment) {
		this.equipment = equipment;
	}

	@Override
	public String toString() {
		return "ComputerRoom [id=" + id + ", computerroomid=" + computerroomid + ", classname=" + classname
				+ ", predeterminedstate=" + predeterminedstate + ", capacity=" + capacity + ", booker=" + booker
				+ ", equipment=" + equipment + "]";
	}
	
}
